
package com.evenmo.string;

/**
 * This is Description 反射demo
 *
 * @author moyongjun
 * @date 2020/01/10
 */
public class Reflect {
    String name;


    public void test(){
        System.out.println("hello");
    }


    private void privMethod(){
        System.out.println("私有方法");
    }

    public Reflect(){
        this.name = name;
        System.out.println("无参构造");
    }

    public Reflect(String name){
        this.name = name;
        System.out.println("带参构造");
    }


    public String toString(){
        return "name="+name;
    }
    public static void main(String[] args) {
        Class<Reflect> reflectClass = Reflect.class;

        Reflect reflect = new Reflect();
        Class<? extends Reflect> aClass = reflect.getClass();

        System.out.println(reflectClass);
        System.out.println(aClass);


        Class<?> aClass1 = null;
        try {
            aClass1 = Class.forName("com.evenmo.string.Reflect");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }

        System.out.println(aClass1);

        System.out.println(aClass.getName());
    }
}
